package com.eco.fanliapp.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.eco.fanliapp.common.response.ServerResponse;
import com.eco.fanliapp.dao.AppGoodsMapper;
import com.eco.fanliapp.dao.GoodsFreeMapper;
import com.eco.fanliapp.dao.SyChannelGoodsMapper;
import com.eco.fanliapp.dao.SyTljGoodsfreeMapper;
import com.eco.fanliapp.entity.*;
import com.eco.fanliapp.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.eco.fanliapp.utils.BigDecimalUtils;
import com.eco.fanliapp.utils.DateFormatUtils;
import com.eco.fanliapp.utils.DateUtils;
import com.eco.fanliapp.vo.HaoDanKuItemInfo;
import com.eco.fanliapp.vo.TbkItemInfoGetInfo;
import com.eco.fanliapp.vo.TbkPrivilegeGetInfo;
import org.apache.commons.beanutils.ConvertUtils;
import org.apache.commons.collections.CollectionUtils;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;


/**
 * <p>
 * 渠道商品对照表 服务实现类
 * </p>
 *
 * @author jobob
 * @since 2019-11-04
 */
@Service
public class SyChannelGoodsServiceImpl extends ServiceImpl<SyChannelGoodsMapper, SyChannelGoods> implements ISyChannelGoodsService {

    private static final Logger log = LoggerFactory.getLogger(SyChannelGoodsServiceImpl.class);
    @Autowired
    private SyChannelGoodsMapper syChannelGoodsMapper;
    @Autowired
    private IAppGeneralfeeschemeService appGeneralfeeschemeService;
    @Autowired
    private ISyChannelUserService syChannelUserService;
    @Autowired
    private IAppOrderfeeschemeService appOrderfeeschemeService;
    @Autowired
    private RedisTemplateService redisTemplateService;
    @Autowired
    private SyTljGoodsfreeMapper syTljGoodsfreeMapper;
    @Autowired
    private GoodsFreeMapper goodsFreeMapper;
    @Autowired
    private AppGoodsMapper appGoodsMapper;
    @Autowired
    private FindItemIdUtils taoBaoUtils;
    @Autowired
    private ISyChannelService syChannelService;
    @Autowired
    private IAppGoodsService iAppGoodsService;
    @Autowired
    private ITaoBaoService taoBaoService;
    @Override
    public SyChannelGoods getSyChannelGoodsByItemId(Long itemId) {
        return syChannelGoodsMapper.getSyChannelGoodsByItemId(itemId);
    }

    @Override
    public ServerResponse<PageInfo> selectSyChannelGoods(Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<SyChannelGoods> list = syChannelGoodsMapper.selectSyChannelGoods();
        if (list.size() == 0 || list == null) {
            return ServerResponse.createByErrorMessage("查询无数据");
        }
        return ServerResponse.createBySuccess("查询成功", new PageInfo(list));
    }

    @Override
    public int delectSyChannelGoods(Long tableId,Long itemId) {
        //删除高佣商品缓存
        String redisKeyStr = "app_channel_good_List";
        redisTemplateService.del(redisKeyStr);
        int i = appGoodsMapper.deleteAppGoodsByItemidNew(itemId.toString());
        String redskey= "sy_tlj_loophole_goods";
        redisTemplateService.del(redskey);
        List<AppGoods> appGoodsList = appGoodsMapper.selectRecommendGoodsAll();
        taoBaoService.getRedisRecommendGoodsList(appGoodsList);
        log.info("删除商品库的高佣商品{}" + i);
        return syChannelGoodsMapper.delectSyChannelGoods(tableId);

    }

    /**
     * 获取渠道下所有单个商品高佣或者固定返
     *
     * @param type 0实时从数据库1优先从redis
     * @return
     */
    @Override
    public List<SyChannelGoods> getAllAppChannelGoods(int type) {

        List<SyChannelGoods> syChannelGoodsList = null;

        String redisKeyStr = "app_channel_good_List";
        if (type == 1 && redisTemplateService.hasKey(redisKeyStr)) {
            syChannelGoodsList = redisTemplateService.getTByListKey(redisKeyStr, SyChannelGoods.class);
        }
        if (syChannelGoodsList == null || syChannelGoodsList.size() <= 0) {
            QueryWrapper queryWrapper = new QueryWrapper();
            queryWrapper.eq("enable", 1);
            queryWrapper.eq("deleted", 0);
            syChannelGoodsList = syChannelGoodsMapper.selectList(queryWrapper);

            if (syChannelGoodsList != null && syChannelGoodsList.size() > 0) {
                redisTemplateService.set(redisKeyStr, syChannelGoodsList, 60 * 5);
            }
        }
        return syChannelGoodsList;
    }

    /**
     * 获取渠道下商品
     *
     * @param itemId
     * @param channelUserId
     * @param type          0实时从数据库1优先从redis
     * @return
     */
    @Override
    public SyChannelGoods getAppChannelGoods(String itemId, String channelUserId, int type) {

        List<SyChannelGoods> syChannelGoodsList = getAllAppChannelGoods(type);
        if (syChannelGoodsList != null && syChannelGoodsList.size() > 0) {
            for (SyChannelGoods syChannelGoods : syChannelGoodsList) {
                if (channelUserId != null && itemId.equals(syChannelGoods.getItemId().toString())) {
                    return syChannelGoods;
                } else if (itemId.equals(syChannelGoods.getItemId().toString())) {
                    return syChannelGoods;
                }
            }
        }
        return null;
    }

    @Override
    public SyChannelGoods selectByCompanyIdAndItemId(AppUser appUser, Long itemid) {
        //判断该用户是否为渠道下用户
        QueryWrapper<SyChannelUser> queryWrapper1 = new QueryWrapper<>();
        queryWrapper1.eq("user_id", appUser.getUserId());
        queryWrapper1.eq("enable", 1);
        queryWrapper1.eq("deleted", 0);
        List<SyChannelUser> list1 = syChannelUserService.list(queryWrapper1);
        if (CollectionUtils.isNotEmpty(list1)) {

            Long channelId = list1.get(0).getChannelId();
            //判断是否是特殊分佣商品
            QueryWrapper<SyChannelGoods> queryWrapper = new QueryWrapper<>();
            queryWrapper.eq("channel_id", channelId);
            queryWrapper.eq("item_id", itemid);
            queryWrapper.eq("enable", 1);
            queryWrapper.eq("deleted", 0);
            List<SyChannelGoods> list = syChannelGoodsMapper.selectList(queryWrapper);

            if (CollectionUtils.isNotEmpty(list)) {
                return list.get(0);
            }
        }
        return null;
    }

    @Override
    public Object getShemeNew(SyChannelGoods syChannelGoods) {
        //1.普通分佣
        String generalFeeScheme = syChannelGoods.getGeneralFeeScheme();
        if (generalFeeScheme != null && !"".equals(generalFeeScheme)) {

            AppGeneralFeeScheme appGeneralFeeScheme = appGeneralfeeschemeService.selectAppGeneralfeeschemeById(Integer.valueOf(generalFeeScheme), 1);
            if (appGeneralFeeScheme != null) {
                return appGeneralFeeScheme;
            }
        }

        //2.杀熟分佣
        String orderFeeScheme = syChannelGoods.getOrderFeeScheme();
        if (orderFeeScheme != null && !"".equals(orderFeeScheme)) {
            AppOrderFeeScheme appOrderFeeScheme = appOrderfeeschemeService.selectAppOrderfeeschemeById(Integer.valueOf(orderFeeScheme));
            return appOrderFeeScheme;
        }

        //3.公司正常的分佣方案
        Integer companyId = syChannelGoods.getCompanyId();
        AppGeneralFeeScheme generalFeeScheme1 = appGeneralfeeschemeService.selectByCompayId(companyId);
        return generalFeeScheme1;
    }


    @Override
    public ServerResponse addSyChannelGoodsNew(SyChannelGoods syChannelGoods, Integer companyId) {
        if (syChannelGoods.getItemId() == null) {
            return ServerResponse.createByErrorMessage("商品Id不可为空");
        }
        //判断商品是否存在淘礼金,免单中
        SyTljGoodsfree syTljGoodsfree1 = syTljGoodsfreeMapper.selectTljGoodsfreeByItemId(syChannelGoods.getItemId());
        HashMap<String, Object> goodsFreeMap = new HashMap<>();
        goodsFreeMap.put("goodsId", syChannelGoods.getItemId().toString());
        goodsFreeMap.put("goodsStatus", 2);
        List<GoodsFree> goodsFree = goodsFreeMapper.selectByGoodsIds(goodsFreeMap);
        if (syTljGoodsfree1 != null && DateUtils.date2Strday(syTljGoodsfree1.getUpdateTime()).equals(DateUtils.date2Strday(new Date())) || goodsFree.size() > 0) {
            return ServerResponse.createByErrorMessage("商品已经在免单或淘礼金中存在");
        }
        SyChannelGoods syChannelGoods2 = syChannelGoodsMapper.selectByItemId(syChannelGoods.getItemId());
        if (syChannelGoods2 != null) {
            return ServerResponse.createByErrorMessage("已存在该商品");
        }
        //商品表是否存在 不存在从好单库、淘宝拉取并插入商品表  存在删除
        AppGoods appGoodsByItemId = iAppGoodsService.findAppGoodsByItemId(String.valueOf(syChannelGoods.getItemId()));
        if (appGoodsByItemId != null) {
            appGoodsMapper.deleteAppGoodsByItemidNew(syChannelGoods.getItemId().toString());
        }
        HaoDanKuItemInfo info = taoBaoUtils.getHaoDanKuItemId(syChannelGoods.getItemId().toString());
        if (info != null && info.getCode() == 1 && info.getData() != null) {
            int i = syChannelGoodsMapper.insert(syChannelGoods);
            if (i > 0) {
                AppGoods goods = HDKUtils.getAppGoodsFromHDK(info.getData());
                goods.setItemTop(8);
                goods.setRecommend(1);
                int i2 = appGoodsMapper.insertAppGoods(goods);
                if (i2 > 0) {
                    //删除高佣商品缓存
                    String redisKeyStr = "app_channel_good_List";
                    redisTemplateService.del(redisKeyStr);
                    String redskey= "sy_tlj_loophole_goods";
                    redisTemplateService.del(redskey);
                    List<AppGoods> appGoodsList = appGoodsMapper.selectRecommendGoodsAll();
                    taoBaoService.getRedisRecommendGoodsList(appGoodsList);
                    return ServerResponse.createBySuccessMessage("添加成功");
                } else {
                    return ServerResponse.createByErrorMessage("添加失败");
                }
            } else {
                return ServerResponse.createByErrorMessage("添加失败");
            }
        } else {
            //查询淘宝详情
            List<TbkItemInfoGetInfo.NTbkItem> items = taoBaoUtils.getTaoBaoItemId(syChannelGoods.getItemId().toString());
            if (items != null && items.size() > 0) {
                for (TbkItemInfoGetInfo.NTbkItem nTbkItem : items) {
                    TbkPrivilegeGetInfo.TbkPrivilege privilege = taoBaoUtils.getPrivilegeItemId(syChannelGoods.getItemId());
                    int i = syChannelGoodsMapper.insert(syChannelGoods);
                    if (i > 0) {
                        AppGoods goods2 = HDKUtils.getAppGoodsFromTB(nTbkItem);
                        goods2.setItemTop(8);
                        goods2.setRecommend(1);
                        goods2.setCouponmoney(Double.valueOf(privilege.getCouponInfo()));
                        goods2.setCouponstarttime(privilege.getCouponStartTime() == null ? "0" : DateFormatUtils.dateToStamp(privilege.getCouponStartTime()).toString());
                        goods2.setCouponendtime(privilege.getCouponEndTime() == null ? "0" : DateFormatUtils.dateToStamp(privilege.getCouponEndTime()).toString());
                        goods2.setEndTime(privilege.getCouponEndTime() == null ? "0" : DateFormatUtils.dateToStamp(privilege.getCouponEndTime()).toString());
                        BigDecimal itemendprice1 = BigDecimalUtils.Format(
                                new BigDecimal(nTbkItem.getZkFinalPrice() == null ? "0" : nTbkItem.getZkFinalPrice())
                                        .subtract(new BigDecimal(privilege.getCouponInfo()))
                        );
                        goods2.setItemendprice(itemendprice1.doubleValue());
                        goods2.setTkrates(privilege.getMaxCommissionRate());
                        goods2.setItemprice(nTbkItem.getZkFinalPrice());
                        goods2.setCreateTime(DateUtils.getNowTimestamp());
                        goods2.setUpdateTime(DateUtils.getNowTimestamp());
                        int i2 = appGoodsMapper.insertAppGoods(goods2);
                        if (i2 > 0) {
                            //删除高佣商品缓存
                            String redisKeyStr = "app_channel_good_List";
                            redisTemplateService.del(redisKeyStr);
                            String redskey= "sy_tlj_loophole_goods";
                            redisTemplateService.del(redskey);
                            List<AppGoods> appGoodsList = appGoodsMapper.selectRecommendGoodsAll();
                            taoBaoService.getRedisRecommendGoodsList(appGoodsList);
                            return ServerResponse.createBySuccessMessage("商品添加成功");
                        } else {
                            return ServerResponse.createByErrorMessage("商品添加失败");
                        }
                    } else {
                        return ServerResponse.createByErrorMessage("商品添加失败");
                    }
                }
            }
        }
        return ServerResponse.createByErrorMessage("新增失败");
    }


    @Override
    public ServerResponse updateSyChannelGoodsNew(SyChannelGoods syChannelGoods) {
        if (syChannelGoods.getItemId() == null) {
            return ServerResponse.createByErrorMessage("商品Id不可为空");
        }
        //商品id是否改变
        if (syChannelGoods.getItemIdNew().equals(syChannelGoods.getItemId())) {
            syChannelGoods.setUpdateTime(new Date());
            int i = syChannelGoodsMapper.updateSyChannelGoods(syChannelGoods);
            if (i > 0) {
                //删除高佣商品缓存
                String redisKeyStr = "app_channel_good_List";
                redisTemplateService.del(redisKeyStr);
                String redskey= "sy_tlj_loophole_goods";
                redisTemplateService.del(redskey);
                List<AppGoods> appGoodsList = appGoodsMapper.selectRecommendGoodsAll();
                taoBaoService.getRedisRecommendGoodsList(appGoodsList);
                return ServerResponse.createBySuccessMessage("商品修改成功");
            }
        } else {
            //商品id改变删除原来的重新添加
            syChannelGoodsMapper.delectSyChannelGoods(syChannelGoods.getItemId());
            syChannelGoods.setItemId(syChannelGoods.getItemIdNew());
            ServerResponse serverResponse = addSyChannelGoodsNew(syChannelGoods, null);
            if (serverResponse.getStatus() == 200) {
                return ServerResponse.createBySuccessMessage("商品修改成功");
            } else {
                return ServerResponse.createBySuccessMessage("修改失败");
            }
        }
        return ServerResponse.createBySuccessMessage("修改失败");
    }

    //废弃
//    @Override
//    public ServerResponse addSyChannelGoods(SyChannelGoods syChannelGoods,Integer companyId) {
//        if (syChannelGoods.getItemId() == null) {
//            return ServerResponse.createByErrorMessage("商品Id不可为空");
//        }
//        //判断商品是否存在淘礼金,免单中
//        SyTljGoodsfree syTljGoodsfree1 = syTljGoodsfreeMapper.selectTljGoodsfreeByItemId(syChannelGoods.getItemId());
//        HashMap<String, Object> goodsFreeMap = new HashMap<>();
//        goodsFreeMap.put("goodsId", syChannelGoods.getItemId().toString());
//        goodsFreeMap.put("goodsStatus", 2);
//        List<GoodsFree> goodsFree = goodsFreeMapper.selectByGoodsIds(goodsFreeMap);
//        if (syTljGoodsfree1 != null && DateUtils.date2Strday(syTljGoodsfree1.getUpdateTime()).equals(DateUtils.date2Strday(new Date())) || goodsFree.size() > 0) {
//            return ServerResponse.createByErrorMessage("商品已经在免单或淘礼金中存在");
//        }
//
//        String channelIdList = syChannelGoods.getChannelIdList();
//        if (StringUtils.isEmpty(channelIdList)) {
//            return ServerResponse.createByErrorMessage("渠道不可为空");
//        }
//
//
//        AppGoods appGoodsByItemId = iAppGoodsService.findAppGoodsByItemId(String.valueOf(syChannelGoods.getItemId()));
//        //如存在商品表
//        if (appGoodsByItemId != null) {
//            String[] str = syChannelGoods.getChannelIdList().split(",");
//            long[] channelIdArr = (long[]) ConvertUtils.convert(str, long.class);
//            int i =0;
//            for (long channelId : channelIdArr) {
//                SyChannelGoods syChannelGoods2 = syChannelGoodsService.selectByChannelAndItemId(syChannelGoods.getItemId(), channelId);
//                //如果存在不插入表
//                if (syChannelGoods2 != null) {
//                    return ServerResponse.createByErrorMessage("渠道 " + syChannelService.getByTableId(channelId).getChannelName() + " 下已存在该商品");
//                }
//                SyChannelGoods syChannelGoods1 = new SyChannelGoods();
//                syChannelGoods1.setCompanyId(companyId);
//                syChannelGoods1.setChannelId(channelId);
//                syChannelGoods1.setItemId(syChannelGoods.getItemId());
//                syChannelGoods1.setGeneralFeeScheme(syChannelGoods.getGeneralFeeScheme());
//                syChannelGoods1.setCommissionType(syChannelGoods.getCommissionType());
//                syChannelGoods1.setCommissionScope(syChannelGoods.getCommissionScope());
//                syChannelGoods1.setFixedCommissionType(syChannelGoods.getFixedCommissionType());
//                syChannelGoods1.setUserId(syChannelGoods.getUserId());
//                i = syChannelGoodsMapper.insert(syChannelGoods1);
//            }
//            if (i > 0) {
//                appGoodsByItemId.setItemTop(8);
//                appGoodsByItemId.setRecommend(1);
//                appGoodsMapper.updateAppGoods(appGoodsByItemId);
//                return ServerResponse.createBySuccess("新增成功");
//            } else {
//                return ServerResponse.createByErrorMessage("新增失败");
//            }
//        }else {//如不存在商品表
//            //如果不存在查好单库
//            HaoDanKuItemInfo info = taoBaoUtils.getHaoDanKuItemId(syChannelGoods.getItemId().toString());
//            if (info != null && info.getCode() == 1 && info.getData() != null) {
//                String[] str = syChannelGoods.getChannelIdList().split(",");
//                long[] channelIdArr = (long[]) ConvertUtils.convert(str, long.class);
//                int i = 0;
//                for (long channelId : channelIdArr) {
//                    SyChannelGoods syChannelGoods2 = syChannelGoodsService.selectByChannelAndItemId(syChannelGoods.getItemId(), channelId);
//                    //如果存在不插入表
//                    if (syChannelGoods2 != null) {
//                        return ServerResponse.createByErrorMessage("渠道 " + syChannelService.getByTableId(channelId).getChannelName() + " 下已存在该商品");
//                    }
//                    SyChannelGoods syChannelGoods1 = new SyChannelGoods();
//                    syChannelGoods1.setCompanyId(companyId);
//                    syChannelGoods1.setChannelId(channelId);
//                    syChannelGoods1.setItemId(syChannelGoods.getItemId());
//                    syChannelGoods1.setGeneralFeeScheme(syChannelGoods.getGeneralFeeScheme());
//                    syChannelGoods1.setCommissionType(syChannelGoods.getCommissionType());
//                    syChannelGoods1.setCommissionScope(syChannelGoods.getCommissionScope());
//                    syChannelGoods1.setFixedCommissionType(syChannelGoods.getFixedCommissionType());
//                    syChannelGoods1.setUserId(syChannelGoods.getUserId());
//                    i = syChannelGoodsMapper.insert(syChannelGoods1);
//                }
//                if (i > 0) {
//                    AppGoods goods = HDKUtils.getAppGoodsFromHDK(info.getData());
//                    goods.setItemTop(8);
//                    goods.setRecommend(1);
//                    int i2 = appGoodsMapper.insertAppGoods(goods);
//                    if (i2 > 0) {
//                        return ServerResponse.createBySuccessMessage("添加成功");
//                    } else {
//                        return ServerResponse.createByErrorMessage("添加失败");
//                    }
//                } else {
//                    return ServerResponse.createByErrorMessage("添加失败");
//                }
//            } else {
//                //查询淘宝详情
//                List<TbkItemInfoGetInfo.NTbkItem> items = taoBaoUtils.getTaoBaoItemId(syChannelGoods.getItemId().toString());
//                if (items != null && items.size() > 0) {
//                    for (TbkItemInfoGetInfo.NTbkItem nTbkItem : items) {
//                        TbkPrivilegeGetInfo.TbkPrivilege privilege = taoBaoUtils.getPrivilegeItemId(syChannelGoods.getItemId());
//
//                        String[] str = syChannelGoods.getChannelIdList().split(",");
//                        long[] channelIdArr = (long[]) ConvertUtils.convert(str, long.class);
//                        int i = 0;
//                        for (long channelId : channelIdArr) {
//                            SyChannelGoods syChannelGoods2 = syChannelGoodsService.selectByChannelAndItemId(syChannelGoods.getItemId(), channelId);
//                            //如果存在不插入表
//                            if (syChannelGoods2 != null) {
//                                return ServerResponse.createByErrorMessage("渠道 " + syChannelService.getByTableId(channelId).getChannelName() + " 下已存在该商品");
//                            }
//                            SyChannelGoods syChannelGoods1 = new SyChannelGoods();
//                            syChannelGoods1.setCompanyId(companyId);
//                            syChannelGoods1.setChannelId(channelId);
//                            syChannelGoods1.setItemId(syChannelGoods.getItemId());
//                            syChannelGoods1.setGeneralFeeScheme(syChannelGoods.getGeneralFeeScheme());
//                            syChannelGoods1.setCommissionType(syChannelGoods.getCommissionType());
//                            syChannelGoods1.setCommissionScope(syChannelGoods.getCommissionScope());
//                            syChannelGoods1.setFixedCommissionType(syChannelGoods.getFixedCommissionType());
//                            syChannelGoods1.setUserId(syChannelGoods.getUserId());
//                            i = syChannelGoodsMapper.insert(syChannelGoods1);
//                        }
//                        if (i > 0) {
//                            AppGoods goods2 = HDKUtils.getAppGoodsFromTB(nTbkItem);
//                            goods2.setItemTop(8);
//                            goods2.setRecommend(1);
//                            goods2.setCouponmoney(Double.valueOf(privilege.getCouponInfo()));
//                            goods2.setCouponstarttime(privilege.getCouponStartTime() == null ? "0" : DateFormatUtils.dateToStamp(privilege.getCouponStartTime()).toString());
//                            goods2.setCouponendtime(privilege.getCouponEndTime() == null ? "0" : DateFormatUtils.dateToStamp(privilege.getCouponEndTime()).toString());
//                            goods2.setEndTime(privilege.getCouponEndTime() == null ? "0" : DateFormatUtils.dateToStamp(privilege.getCouponEndTime()).toString());
//                            BigDecimal itemendprice1 = BigDecimalUtils.Format(
//                                    new BigDecimal(nTbkItem.getZkFinalPrice() == null ? "0" : nTbkItem.getZkFinalPrice())
//                                            .subtract(new BigDecimal(privilege.getCouponInfo()))
//                            );
//                            goods2.setItemendprice(itemendprice1.doubleValue());
//                            goods2.setTkrates(privilege.getMaxCommissionRate());
//                            goods2.setItemprice(nTbkItem.getZkFinalPrice());
//                            goods2.setCreateTime(DateUtils.getNowTimestamp());
//                            goods2.setUpdateTime(DateUtils.getNowTimestamp());
//                            int i2 = appGoodsMapper.insertAppGoods(goods2);
//                            if (i2 > 0) {
//                                return ServerResponse.createBySuccessMessage("商品添加成功");
//                            } else {
//                                return ServerResponse.createByErrorMessage("商品添加失败");
//                            }
//                        } else {
//                            return ServerResponse.createByErrorMessage("商品添加失败");
//                        }
//                    }
//                }
//                return ServerResponse.createByErrorMessage("商品不存在");
//            }
//        }
//    }

    @Override
    public SyChannelGoods selectByChannelAndItemId(Long itemId, Long channelId) {
        return syChannelGoodsMapper.selectByChannelAndItemId(itemId, channelId);
    }


    @Override
    public List<SyChannelGoods> findChannelGoodsCommission() {
        return syChannelGoodsMapper.findChannelGoodsCommission();
    }


    public static void main(String[] args) {

    }

}
